﻿
using System.Runtime.Serialization;

namespace TrafficArchives.Common
{
    /// <summary>
    /// 分页
    /// </summary>
    [DataContract]
    public class Pagination
    {
        /// <summary>
        ///
        /// </summary>
        public Pagination()
        {
            PageIndex = 0;
            PageSize = 20;
            Enabled = false;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="pageSize">分页大小</param>
        public Pagination(int pageIndex, int pageSize)
        {
            PageIndex = pageIndex;
            PageSize = pageSize;
            Enabled = true;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="pageSize">分页大小</param>
        /// <param name="enabled">是否启用分页</param>
        public Pagination(int pageIndex, int pageSize, bool enabled)
        {
            PageIndex = pageIndex;
            PageSize = pageSize;
            Enabled = enabled;
        }

        #region 属性

        /// <summary>
        /// 页索引: 索引从 0 开始
        /// </summary>
        [DataMember]
        public int PageIndex { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        [DataMember]
        public int PageSize
        {
            get;
            set;
        }

        /// <summary>
        /// 总记录数
        /// </summary>
        [DataMember]
        public int TotalRecordCount
        {
            get;
            set;
        }

        /// <summary>
        /// 是否启用分页
        /// </summary>
        [DataMember]
        public bool Enabled
        {
            get;
            set;
        }

        #endregion 属性
    }
}